package com.attendance.www.hr.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.attendance.www.hr.dao.mapper.MainJobsMapper;
import com.attendance.www.hr.entitys.MainJobs;
import com.attendance.www.hr.entitys.MainJobsExample;
import com.attendance.www.hr.service.IMainJobsService;

@Service
public class MainJobsServiceImpl implements IMainJobsService {

	@Resource
	private MainJobsMapper mainJobsDao;

	/**
	 * 查询
	 */
	@Override
	public List<MainJobs> getMainJobsList() {
		MainJobsExample mainJobsExample=new MainJobsExample();
		mainJobsExample.setOrderByClause("superior_code asc");
		List<MainJobs> mainJobsList = mainJobsDao.selectByExample(mainJobsExample);
		return mainJobsList;
	}
	
	/**
	 * 增加
	 */
	@Override
	public void saveMainJobs(List<MainJobs> mainJobsList) {
		for(int i=0;i<mainJobsList.size();i++) {
			mainJobsDao.insertSelective(mainJobsList.get(i));
		}
	}
	
	/**
	 * 删除
	 */
	@Override
	public boolean deleteMainJobs() {
		if(mainJobsDao.deleteByExample(new MainJobsExample())>0) {
			return true;
		}
		return false;
	}
}
